//
//  UIImage+Extension.swift
//  rxCoreLogic
//
//  Created by yq on 2021/1/27.
//

import Foundation
import UIKit


extension UIImage  {

	static func imageFromColor(color: UIColor) -> UIImage{
		let viewSize = CGSize(width: 1, height: 1)
		let rect: CGRect = CGRect(x: 0, y: 0, width: viewSize.width, height: viewSize.height)
		UIGraphicsBeginImageContext(rect.size)
		let context: CGContext = UIGraphicsGetCurrentContext()!
		context.setFillColor(color.cgColor)
		context.fill(rect)
		let image = UIGraphicsGetImageFromCurrentImageContext()
		UIGraphicsGetCurrentContext()
		return image!
	}
}

